home *** CD-ROM | disk | FTP | other *** search
/ Czech Logic, Card & Gambling Games / Logické hry.iso / hry / Fish Fillets / script / steel / code.lua next >
Encoding:
Text File  |  2005-07-16  |  2.4 KB  |  81 lines

  1.  
  2. -- -----------------------------------------------------------------
  3. -- Init
  4. -- -----------------------------------------------------------------
  5. local function prog_init()
  6.     initModels()
  7.     local pokus = getRestartCount()
  8.  
  9.  
  10.     -- -------------------------------------------------------------
  11.     local function prog_init_room()
  12.         local pom1, pom2, pomb1, pomb2 = 0, 0, false, false
  13.  
  14.         room.houk = -1
  15.         room.citac = random(40) + 40
  16.         local bgfaze
  17.  
  18.         return function()
  19.             pom1 = 0
  20.             if room.citac > 0 then
  21.                 room.citac = room.citac - 1
  22.             end
  23.             if room.houk == -1 then
  24.                 if valec.dir == dir_left then
  25.                     room.houk = room.houk + 1
  26.                 elseif room.citac == 0 and isReady(small) then
  27.                     addm(0, "steel-m-"..random(2))
  28.                     room.citac = -1
  29.                 else
  30.                 end
  31.             else
  32.                 switch(math.mod(room.houk, 10)){
  33.                     [2] = function()
  34.                         room:talk("steel-x-redalert", VOLUME_FULL)
  35.                         bgfaze = 1
  36.                         pom1 = 1
  37.                     end,
  38.                     [4] = function()
  39.                         room:talk("steel-x-redalert", VOLUME_FULL)
  40.                     end,
  41.                     [9] = function()
  42.                         bgfaze = 2
  43.                         pom1 = 1
  44.                     end,
  45.                 }
  46.                 room.houk = room.houk + 1
  47.             end
  48.             if pom1 == 1 then
  49.                 for key, model in pairs(getModelsTable()) do
  50.                     if model ~= small and model ~= big then
  51.                         model.afaze = bgfaze
  52.                         model:updateAnim()
  53.                     end
  54.                 end
  55.                 game_changeBg("images/"..codename.."/steel-pozadi"..bgfaze..".png")
  56.             end
  57.         end
  58.     end
  59.  
  60.     -- --------------------
  61.     local update_table = {}
  62.     local subinit
  63.     subinit = prog_init_room()
  64.     if subinit then
  65.         table.insert(update_table, subinit)
  66.     end
  67.     return update_table
  68. end
  69. local update_table = prog_init()
  70.  
  71.  
  72. -- -----------------------------------------------------------------
  73. -- Update
  74. -- -----------------------------------------------------------------
  75. function prog_update()
  76.     for key, subupdate in pairs(update_table) do
  77.         subupdate()
  78.     end
  79. end
  80.  
  81.